/**
 * 冒泡排序
 * 作者:夏天
 * qq:1205232048
 */
public class Manin07 {
    public static void main(String[] args) {
        int[] a = {4,6,1,8,2,3,7,9};
        sort(a);
        for (int i : a) {
            System.out.print(i + " ");
        }
    }
    public static void sort(int[] a){
        for (int i = 0; i < a.length - 1; i++) {
            for (int j = 0; j < a.length - 1 - i; j++) {
                if(a[j] > a[j+1]){
                    int temp = a[j];
                    a[j] = a[j+1];
                    a[j+1] = temp;
                }
            }
        }
    }
}
